<?php
namespace c\goods;

/**
 * Description of v
 *
 * @author YeFng
 */
class v extends g
{
    function index_home()
    {
        $id = intval($_GET['id']);
        $t = array('t1'=>array('as'=>$this->table),
                'c'=>array('as'=>'company', 'join'=>'LEFT JOIN', 'on'=>'c.id=t1.company_id'));
        $d = $this->db->getOne($t, 't1.*,c.name company_name', 't1.id='.$id .' AND state>0');
        $this->isExist($d);

        
        //seo
        $this->title = $d['title'];
        $d['keywords'] && $this->t_var['seo']['keywords'] = $d['keywords'];
        $d['description'] && $this->t_var['seo']['description'] = $d['description'];
        
        //pics
        $pics = $this->db->getCol('goods_pic', 'path', 'data_id='.$id);
        $d['pic'] && $pics[] = $d['pic'];
        unset($d['pic']);
        
        //Attr
        $AttrC = \YF_f::initC('\c\attribute\g', '', $this->table_attr);
        $attrR = $AttrC->getLi($id);
        
        $this->t_var['data'] = $d;
		$this->Comm = \YF_f::initC('\c\goods\comment');
        $this->loadTemplate('goods/show', array('pics'=>$pics, 'attrR'=>$attrR));
        $this->loadLayout('goods');
    }
}
